@echo off
setlocal enabledelayedexpansion
title One-Click Activation and Software Installer
chcp 65001 > nul

rem =================================================================
rem Auto-elevate to Administrator if not already running as admin
rem =================================================================
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo [INFO] Requesting administrator privileges...
    powershell -Command "Start-Process '%~f0' -Verb RunAs"
    exit /b
)

:MENU
cls
echo ===============================================
echo   One-Click Activation and Software Installer
echo ===============================================
echo.
echo Please select an option:
echo.
echo 1. Activate JetBrains Software
echo 2. Deactivate JetBrains Software
echo 3. Activate Windows and Office
echo 4. PMAS
echo 5. Install Weiyun (Online Script Method)
echo 6. Install Weiyun (Winget Method)
echo 7. Install WinRAR
echo 8. Windows Utility
echo 9. Autodesk-Uninstaller
echo 0. Exit
echo.
set /p choice="Enter your choice (0-9): "

if "%choice%"=="1" goto ACTIVATE_JETBRAINS
if "%choice%"=="2" goto DEACTIVATE_JETBRAINS
if "%choice%"=="3" goto ACTIVATE_WIN_OFFICE
if "%choice%"=="4" goto PMAS
if "%choice%"=="5" goto INSTALL_WEIYUN_SCRIPT
if "%choice%"=="6" goto INSTALL_WEIYUN_WINGET
if "%choice%"=="7" goto INSTALL_WINRAR
if "%choice%"=="8" goto WINDOWS_UTILITY
if "%choice%"=="9" goto AUTODESK_UNINSTALLER
if "%choice%"=="0" goto EXIT
echo Invalid choice. Please try again.
pause
goto MENU

:ACTIVATE_JETBRAINS
echo.
echo [INFO] Activating JetBrains Software...
echo [INFO] Executing: irm ckey.run^|iex
powershell -ExecutionPolicy Bypass -Command "try { irm ckey.run | iex } catch { Write-Host '[Error] JetBrains activation failed, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo JetBrains activation completed. Press any key to return to menu...
pause
goto MENU

:DEACTIVATE_JETBRAINS
echo.
echo [INFO] Deactivating JetBrains Software...
echo [INFO] Executing: irm ckey.run/uninstall^|iex
powershell -ExecutionPolicy Bypass -Command "try { irm ckey.run/uninstall | iex } catch { Write-Host '[Error] JetBrains deactivation failed, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo JetBrains deactivation completed. Press any key to return to menu...
pause
goto MENU

:ACTIVATE_WIN_OFFICE
echo.
echo [INFO] Activating Windows and Office...
echo [INFO] Executing: irm https://get.activated.win ^| iex
powershell -ExecutionPolicy Bypass -Command "try { irm https://get.activated.win | iex } catch { Write-Host '[Error] Windows and Office activation failed, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo Windows and Office activation completed. Press any key to return to menu...
pause
goto MENU

:PMAS
echo.
echo [INFO] Running PMAS...
echo [INFO] Executing: irm tinyurl.com/getpmas ^| iex
powershell -ExecutionPolicy Bypass -Command "try { irm tinyurl.com/getpmas | iex } catch { Write-Host '[Error] PMAS execution failed, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo PMAS completed. Press any key to return to menu...
pause
goto MENU

:INSTALL_WEIYUN_SCRIPT
echo.
echo [INFO] Installing Weiyun using online script method...
echo [INFO] Executing: irm https://gitee.com/xavierlab/weiyun_downloader/raw/main/weiyun_installer_online.ps1 ^| iex
powershell -ExecutionPolicy Bypass -Command "try { irm https://gitee.com/xavierlab/weiyun_downloader/raw/main/weiyun_installer_online.ps1 | iex } catch { Write-Host '[Error] Online script execution failed, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo Weiyun installation (script method) completed. Press any key to return to menu...
pause
goto MENU

:INSTALL_WEIYUN_WINGET
echo.
echo [INFO] Installing Weiyun using winget method...
echo [INFO] Executing: winget install --id=Tencent.Weiyun -v "3.9.0" -e --silent --accept-package-agreements --accept-source-agreements
winget install --id=Tencent.Weiyun -v "3.9.0" -e --silent --accept-package-agreements --accept-source-agreements
echo.
echo Weiyun installation (winget method) completed. Press any key to return to menu...
pause
goto MENU

:INSTALL_WINRAR
echo.
echo [INFO] Installing WinRAR...
echo [INFO] Executing: irm "https://dub.sh/oneclickrar" ^| iex
powershell -ExecutionPolicy Bypass -Command "try { irm \"https://dub.sh/oneclickrar\" | iex } catch { Write-Host '[Error] WinRAR installation failed, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo WinRAR installation completed. Press any key to return to menu...
pause
goto MENU

:WINDOWS_UTILITY
echo.
echo [INFO] Running Windows Utility...
echo [INFO] Executing: irm "https://christitus.com/win" ^| iex
powershell -ExecutionPolicy Bypass -Command "try { irm \"https://christitus.com/win\" | iex } catch { Write-Host '[Error] Windows Utility failed to run, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo Windows Utility completed. Press any key to return to menu...
pause
goto MENU

:AUTODESK_UNINSTALLER
echo.
echo [INFO] Running Autodesk Uninstaller...
echo [INFO] Executing: irm https://gitee.com/xavierlab/weiyun_downloader/raw/main/autodesk-uninstaller.ps1 ^| iex
powershell -ExecutionPolicy Bypass -Command "try { irm https://gitee.com/xavierlab/weiyun_downloader/raw/main/autodesk-uninstaller.ps1 | iex } catch { Write-Host '[Error] Autodesk Uninstaller failed to run, please check network connection' -ForegroundColor Red; Write-Host 'Error details:' $_.Exception.Message -ForegroundColor Red; Read-Host 'Press Enter to continue' }"
echo.
echo Autodesk Uninstaller completed. Press any key to return to menu...
pause
goto MENU

:EXIT
echo.
echo Thank you for using Windows Activation and Software Installer!
echo Press any key to exit...
pause
exit /b

